home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wgdb-42.lha / wgdb-4.2 / include / ansidecl.h < prev    next >
C/C++ Source or Header  |  1992-09-11  |  3KB  |  110 lines

  1. /* ANSI and traditional C compatability macros
  2.    Copyright 1991 Free Software Foundation, Inc.
  3.    This file is part of the GNU C Library.
  4.  
  5. This program is free software; you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation; either version 2 of the License, or
  8. (at your option) any later version.
  9.  
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. GNU General Public License for more details.
  14.  
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18.  
  19. /* ANSI and traditional C compatibility macros
  20.  
  21.    ANSI C is assumed if __STDC__ is #defined.
  22.  
  23.    Macro    ANSI C definition    Traditional C definition
  24.    -----    ---- - ----------    ----------- - ----------
  25.    PTR        `void *'        `char *'
  26.    LONG_DOUBLE    `long double'        `double'
  27.    CONST    `const'            `'
  28.    VOLATILE    `volatile'        `'
  29.    SIGNED    `signed'        `'
  30.    PTRCONST    `void *const'        `char *'
  31.  
  32.    DEFUN(name, arglist, args)
  33.  
  34.     Defines function NAME.
  35.  
  36.     ARGLIST lists the arguments, separated by commas and enclosed in
  37.     parentheses.  ARGLIST becomes the argument list in traditional C.
  38.  
  39.     ARGS list the arguments with their types.  It becomes a prototype in
  40.     ANSI C, and the type declarations in traditional C.  Arguments should
  41.     be separated with `AND'.  For functions with a variable number of
  42.     arguments, the last thing listed should be `DOTS'.
  43.  
  44.    DEFUN_VOID(name)
  45.  
  46.     Defines a function NAME, which takes no arguments.
  47.  
  48.    EXFUN(name, prototype)
  49.  
  50.     Is used in an external function declaration.
  51.     In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in
  52.     parentheses).  In traditional C it is `NAME()'.
  53.     For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'.
  54.  
  55.     For example:
  56.     extern int EXFUN(printf, (CONST char *format DOTS));
  57.     int DEFUN(fprintf, (stream, format),
  58.           FILE *stream AND CONST char *format DOTS) { ... }
  59.     void DEFUN_VOID(abort) { ... }
  60. */
  61.  
  62. #ifndef    _ANSIDECL_H
  63.  
  64. #define    _ANSIDECL_H    1
  65.  
  66.  
  67. /* Every source file includes this file,
  68.    so they will all get the switch for lint.  */
  69. /* LINTLIBRARY */
  70.  
  71.  
  72. #ifdef    __STDC__
  73.  
  74. #define    PTR        void *
  75. #define    PTRCONST    void *CONST
  76. #define    LONG_DOUBLE    long double
  77.  
  78. #define    AND        ,
  79. #define    NOARGS        void
  80. #define    CONST        const
  81. #define    VOLATILE    volatile
  82. #define    SIGNED        signed
  83. #define    DOTS        , ...
  84.  
  85. #define    EXFUN(name, proto)        name proto
  86. #define    DEFUN(name, arglist, args)    name(args)
  87. #define    DEFUN_VOID(name)        name(NOARGS)
  88.  
  89. #else    /* Not ANSI C.  */
  90.  
  91. #define    PTR        char *
  92. #define    PTRCONST    PTR
  93. #define    LONG_DOUBLE    double
  94.  
  95. #define    AND        ;
  96. #define    NOARGS
  97. #define    CONST
  98. #define    VOLATILE
  99. #define    SIGNED
  100. #define    DOTS
  101.  
  102. #define    EXFUN(name, proto)        name()
  103. #define    DEFUN(name, arglist, args)    name arglist args;
  104. #define    DEFUN_VOID(name)        name()
  105.  
  106. #endif    /* ANSI C.  */
  107.  
  108.  
  109. #endif    /* ansidecl.h    */
  110.